<template>
	<view class="login-page  " style="height: 100vh;">
		<!-- #ifndef  H5 -->
		<!-- <custom-navbar is-back title="登录" ></custom-navbar> -->
		<!-- #endif -->
		<view class="lb">
			<image class="lbi"
				src="@/static/images/lb.png" />
		</view>
		<view class="tr">
			<image class="tri"
				src="@/static/images/rt.png" />
		</view>
		<view class="main">
			<view class="logo">
				<image class="logoi" :src="appConfig.favicon" mode="aspectFill"></image>
			</view>
			<view class="adtext">
				<view style="color: #D6372E; display: flex; height: 64rpx; align-items: center;">
					<text style="border-bottom: #D6372E 2px solid;">
						源宝
					</text>
					<image style="display: block;width: 50rpx; height: 50rpx;"
						src="">
					</image>
				</view>
				<view style="border-bottom: #000 2px solid; display: inline;">
					让消费者伟大起来
				</view>
			</view>
			<view class="oparte">
				<view class="fastlogin" @tap="gotoLogin">
					登录
				</view>
				<!-- <view class="passlogin" @tap="quickLogon">
					注册
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapGetters
	} from "vuex";
	import { apiRegisterGetPhone, apiSilentLogin } from '@/api/app';
	export default {
		components: {},
		data() {
			return {
				
			}
		},
		computed: {},
		onLoad() {

		},
		onUnload() {},
		mounted() {},
		methods: {
			...mapMutations(["login"]),
			...mapActions(["getUser"]),
			gotoLogin() {
				uni.navigateTo({
					url:'/pages/login/index'
				})
			},
			// const data = await apiAuthLogin({
			// 	code: wxCode,
			// 	nickname: nickName,
			// 	headimgurl: avatarUrl,
			// });
			async quickLogon(mobile){
				const vs = this
				uni.navigateTo({
					url:'/pages/register/register'
				})
				// wx.login({
				// 	success(res) {
				// 		uni.showLoading({
				// 			title: "登录中...",
				// 			mask: true,
				// 		});
				// 		console.log(res);
				// 		apiSilentLogin({
				// 			code: res.code
				// 		}).then(res => {
				// 			vs.loginHandle(res);
				// 			if(res.mobile == ''){
								
				// 			}else{
				// 				uni.switchTab({
				// 					url:'/pages/index/index'
				// 				})
				// 			}
				// 		}).finally((res) => {
				// 			uni.hideLoading();
				// 		});
				// 	}
				// })
				
			},
			// 登录结果处理
			async loginHandle(data) {
				this.login(data);
				this.getUser();
				// 更新购物车
				this.$store.dispatch("getCartNum");
				uni.hideLoading();
			},
			// getphonenumber(e){
			// 	apiRegisterGetPhone({
			// 		js_code:e.detail.code
			// 	}).then(res=>{
			// 		this.quickLogon(res.phoneNumber)
			// 	})
			// }
		}

	};
</script>
<style lang="scss" scoped>
	uni-page-body {
		height: 100vh;
	}

	.login-page {
		height: 100%;
		background: linear-gradient(to bottom, #FFECED 10%, #FFFFFF 100%);
	}

	.main {
		position: relative;
		top: 300rpx;

		.logo {
			width: 200rpx;
			height: 200rpx;
			margin: 0 auto;

			.logoi {
				width: 100%;
				height: 100%;
			}
		}

		.adtext {
			width: 568rpx;
			font-size: 46rpx;
			font-weight: bold;
			margin: 220rpx auto 150rpx auto;
		}
	}

	.oparte {
		width: 568rpx;
		margin: 0 auto;
		text-align: center;
		font-size: 29rpx;

		.fastlogin {
			background-color: #D6372E;
			line-height: 90rpx;
			color: #FFF;
			border-radius: 100rpx;
		}

		.passlogin {
			line-height: 88rpx;
			border: 2rpx #D6372E solid;
			color: #D6372E;
			margin-top: 30rpx;
			border-radius: 100rpx;
		}
	}


	.lb {
		width: 316rpx;
		height: 208rpx;
		position: absolute;
		bottom: 0;
		left: 0;

		.lbi {
			width: 100%;
			height: 100%;
		}
	}

	.tr {
		width: 168rpx;
		height: 236rpx;
		position: absolute;
		top: 0;
		right: 0;

		.tri {
			width: 100%;
			height: 100%;

		}
	}
</style>